<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- <select name="" id="">
        <option value="">1900</option>
        <option value="">1901</option>
    </select> -->
</body>

</html>
<script>
    // 1.while循环
    // 基本控制结构
    // while (限制条件) {
    //     满足条件(条件为真)不断执行的循环体(语句块)
    // }

    // var num = 1;
    // while (num <= 10) {
    //     console.log('循环体执行了' + num);
    //     num++;
    // }
    // console.log('hehe');
    // console.log(num); //11

    // var num = 1;
    // while (num <= 10000) {
    //     document.write('<li>' + num + '</li>');
    //     num++;
    // }

    document.write('<select>');

    var year = 1900; //初始化
    while (year <= 2099) { //限制条件
        //循环体
        document.write('<option>' + year + '</option>');
        year++;
    }
    document.write('</select>');
</script>